/*******************************************************************************
 * Copyright (c) 2011 LegSem.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the GNU Public License v3.0
 * which accompanies this distribution, and is available at
 * http://www.gnu.org/licenses/gpl-3.0.txt
 * 
 * Contributors:
 *     LegSem - initial API and implementation
 ******************************************************************************/
package com.legsem.legstar.cci;

import com.legsem.legstar.LegStarBoundBean;
import com.legstar.host.invoke.model.HostProgram;

/**
 * Describes an interaction with a the host.
 * <p/>
 * Following the JCA specification the properties are bound.
 * <p/>
 * This does not specify input and output structures which will be described by
 * specialized specs.
 */
public abstract class LegStarInteractionSpecImpl extends LegStarBoundBean
        implements LegStarInteractionSpec {

    private static final long serialVersionUID = 5632464811760682983L;

    private HostProgram hostProgram;
    private String hostCharset;
    private String interactionId;

    public HostProgram getHostProgram() {
        return hostProgram;
    }

    public void setHostProgram(HostProgram hostProgram) {
        HostProgram oldHostProgram = getHostProgram();
        this.hostProgram = hostProgram;
        firePropertyChange("HostProgram", oldHostProgram, hostProgram);

    }

    public String getHostCharset() {
        return hostCharset;
    }

    public void setHostCharset(String hostCharset) {
        String oldHostCharset = getHostCharset();
        this.hostCharset = hostCharset;
        firePropertyChange("HostCharset", oldHostCharset, hostCharset);

    }

    public String getInteractionId() {
        return interactionId;
    }

    public void setInteractionId(String interactionId) {
        String oldInteractionId = getInteractionId();
        this.interactionId = interactionId;
        firePropertyChange("InteractionId", oldInteractionId, interactionId);

    }

    @Override
    public String toString() {
        StringBuilder builder = new StringBuilder();
        builder.append("[hostProgram=");
        builder.append(hostProgram);
        builder.append(", hostCharset=");
        builder.append(hostCharset);
        builder.append(", interactionId=");
        builder.append(interactionId);
        builder.append("]");
        return builder.toString();
    }

}
